import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    //用于保存当前登录的管理员名
    adminName: "",
    //保存当前项目的全局设置信息
    globalSettings: {
      apiUrl: "http://127.0.0.1:8090", //默认的初始值
    },
  },
  mutations: {
    //调用事件方法 this.$store.commit('setAdminname)
    setAdminname(state, newName) {
      state.adminName = newName;
    },
    setGlobalSettings(state, newSettings) {
      state.globalSettings = newSettings;
    },
  },
  actions: {},
  modules: {},
});
